{% block sw_extension_sdk_module %}
<sw-page
    class="sw-extension-sdk-module"
    :show-search-bar="showSearchBar"
    :show-smart-bar="showSmartBar"
>
    <template
        v-if="showSmartBar"
        #smart-bar-header
    >
        {% block sw_extension_sdk_module_header %}
        <template v-if="!isLoading">
            <h2>{{ $tc(module.heading ?? '') }}</h2>
        </template>
        {% endblock %}
    </template>

    <template
        v-if="showSmartBar && back"
        #smart-bar-back
    >
        <router-link
            :to="{ name: back }"
        >
            <mt-icon
                name="regular-chevron-left"
                size="16px"
            />
        </router-link>
    </template>

    {% block sw_extension_sdk_module_smart_bar_buttons %}
    <template
        v-if="showSmartBar"
        #smart-bar-actions
    >
        <mt-button
            v-for="button in smartBarButtons"
            :id="button.buttonId"
            :key="button.buttonId"
            :disabled="button.disabled"
            :variant="button.variant"
            size="default"
            @click="button.onClickCallback"
        >
            {{ $tc(button.label ?? '') }}
        </mt-button>
    </template>
    {% endblock %}

    <template #content>
        {% block sw_extension_sdk_module_content %}
        {% block sw_extension_sdk_module_content_iframe_renderer %}
        <sw-iframe-renderer
            v-if="!isLoading"
            ref="iframeRenderer"
            :src="module.baseUrl"
            :location-id="module.locationId"
            full-screen
        />
        {% endblock %}

        {% block sw_extension_sdk_module_content_loader %}
        <sw-loader v-else-if="!timedOut" />
        {% endblock %}

        {% block sw_extension_sdk_module_content_error_state %}
        <sw-my-apps-error-page v-if="timedOut" />
        {% endblock %}
        {% endblock %}
    </template>

    {% block sw_extension_sdk_module_language_switch %}
    <template
        v-if="showSmartBar && showLanguageSwitch"
        #language-switch
    >
        <sw-language-switch
            :change-global-language="true"
            @on-change="onChangeLanguage"
        />
    </template>
    {% endblock %}
</sw-page>
{% endblock %}
